package com.dnjn.happiness.emo.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dnjn.happiness.emo.domain.EmoTeamNumberOfCommHistory;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 团队历史沟通人数 留180天数据Mapper接口
 *
 * @author happiness
 * @date 2023-10-28
 */
public interface EmoTeamNumberOfCommHistoryMapper extends BaseMapper<EmoTeamNumberOfCommHistory> {

    @Delete(" DELETE FROM emo_team_number_of_comm_history WHERE curr_date <= #{delFlag} ")
    void deleteNumberOfCommHistoryByDaysAgo(String delFlag);

    @Select(" SELECT curr_date, count, dept_id FROM emo_team_number_of_comm_history WHERE dept_id = #{deptId} AND curr_date BETWEEN #{startTime} AND #{endTime} ORDER BY curr_date ")
    List<EmoTeamNumberOfCommHistory> currenDeptHistoryCounts(@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("deptId")Long deptId);
}
